import enum
from django.db import models


class RoleLevel(enum.Enum):
    ROOT = 0
    MANAGER = 1
    WORKER = 2
    NOVICE = 3


class Merchant(models.Model):
    merchant_name = models.CharField(max_length=255, unique=True)
    desc = models.CharField(max_length=1024)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)


class Role(models.Model):
    role_name = models.CharField(max_length=64, unique=True)
    merchant_id = models.IntegerField()
    supervisor_id = models.IntegerField()
    role_level = models.IntegerField()
    desc = models.CharField(max_length=2048)
    perm = models.CharField(max_length=1024, default='0')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
